<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改优惠券兑换码')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-couponReceive-edit" th:object="${couponReceive}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">兑换码：</label>
            <div class="col-sm-4">
                <input name="code" th:field="*{code}" class="form-control" type="text" disabled>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">兑换码二维码：</label>
            <div class="col-sm-4">
                <img th:src="*{codeUrl}" style="max-width: 200px;max-height: 200px;">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">总发放量：</label>
            <div class="col-sm-4">
                <input name="totalIssuance" th:field="*{totalIssuance}" class="form-control" type="number" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">已兑换数量：</label>
            <div class="col-sm-4">
                <input name="totalGet" th:field="*{receiveNum}" class="form-control" type="number" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否上架：</label>
            <div class="col-sm-4">
                <div class="radio-box" th:each="dict : ${@dict.getType('is_enable')}">
                    <input type="radio" th:id="${dict.dictCode}" name="couponStatus" th:field="*{isEnable}"
                           th:value="${dict.dictValue}">
                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: ztree-js"/>
<script type="text/javascript">
    var prefix = ctx + "back/couponReceive";


    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-couponReceive-edit').serialize());
        }
    }
</script>
</body>
</html>